import { defineStore } from 'pinia'
import { ref } from 'vue'
import { useLanguageStore } from './language'
import { agencyAsync } from '@/appox/appox'
import { appoxEnums } from '@/appox/appox'
import { appoxUtility } from '@/appox/appox'
import { AppoxTimeWithSession } from '@/appox/appox'

export const useSystemStatusStore = defineStore('systemStatus', () => {
  // 状态
  const appStatus = ref('---')
  const internetTime = ref('---')
  const hostTime = ref('---')
  const gnssTime = ref('---')
  const deviceStatus = ref('---')
  const storageStatus = ref('---')
  const memoryStatus = ref('---')
  const gpuMemoryStatus = ref('---')
  const cpuStatus = ref('---')
  const recordQueueStatus = ref('---')
  const videoProcessQueueStatus = ref('---')
  const replayNeckStatus = ref('---')
  const baseThreadStatus = ref('---')
  const mainThreadStatus = ref('---')
  const processThreadStatus = ref('---')
  const fileThreadStatus = ref('---')
  const busFlowStatus = ref('---')
  const videoFlowStatus = ref('---')
  const startStopStatus = ref('---')
  const internetStatus = ref('---')

  // 更新状态标志
  const isUpdatingAppStatus = ref(false)
  const isUpdatingInternetTime = ref(false)
  const isUpdatingHostTime = ref(false)
  const isUpdatingGNSSTime = ref(false)
  const isUpdatingDeviceStatus = ref(false)
  const isUpdatingStorageStatus = ref(false)
  const isUpdatingMemoryStatus = ref(false)
  const isUpdatingCPUStatus = ref(false)
  const isUpdatingRecordQueueStatus = ref(false)
  const isUpdatingVideoProcessQueueStatus = ref(false)
  const isUpdatingBaseThreadStatus = ref(false)
  const isUpdatingMainThreadStatus = ref(false)
  const isUpdatingProcessThreadStatus = ref(false)
  const isUpdatingFileThreadStatus = ref(false)
  const isUpdatingBusFlowStatus = ref(false)
  const isUpdatingVideoFlowStatus = ref(false)
  const isUpdatingStartStopStatus = ref(false)
  const isUpdatingInternetStatus = ref(false)
  const isUpdatingGPUMemoryStatus = ref(false)
  const isUpdatingReplayNeckStatus = ref(false)

  // 临时数据
  let timeInSession = null

  // 获取应用状态文本
  function getAppStatusText(appMode, appStatus, withRec, isChinese) {
    if (appStatus === appoxEnums.ApplicationStatus.Tasking) {
      return isChinese ? '独立任务运行中' : 'Task Running'
    }
    else if (appStatus === appoxEnums.ApplicationStatus.Idle) {
      return isChinese ? '空闲' : 'Idle'
    }
    else if (appStatus === appoxEnums.ApplicationStatus.Starting) {
      return isChinese ? 'Session启动中' : 'Starting Session'
    }
    else if (appStatus === appoxEnums.ApplicationStatus.Stopping) {
      return isChinese ? 'Session停止中' : 'Stopping Session'
    }
    else if (appStatus === appoxEnums.ApplicationStatus.Running) {
      if (appMode === appoxEnums.ApplicationMode.Online) {
        return withRec ? 
          (isChinese ? '在线采集中' : 'Online Recording') : 
          (isChinese ? '在线预览中' : 'Online Previewing')
      } else if (appMode === appoxEnums.ApplicationMode.Remote) {
        return withRec ? 
          (isChinese ? '远程采集中' : 'Remote Recording') : 
          (isChinese ? '远程预览中' : 'Remote Previewing')
      } else if (appMode === appoxEnums.ApplicationMode.Offline) {
        return withRec ? 
          (isChinese ? '离线处理中' : 'Offline Generating') : 
          (isChinese ? '离线检查中' : 'Offline Checking')
      } else if (appMode === appoxEnums.ApplicationMode.Replay) {
        return isChinese ? '回放中' : 'Replaying'
      }
    }
    return '---'
  }

  // 格式化时间为yyyy-MM-dd-HH-mm-ss-fff,UTC格式
  function formatDateTime(date) {
    if (!date) return '---'
    const year = date.getFullYear()
    const month = String(date.getMonth() + 1).padStart(2, '0')
    const day = String(date.getDate()).padStart(2, '0')
    const hours = String(date.getHours()).padStart(2, '0')
    const minutes = String(date.getMinutes()).padStart(2, '0')
    const seconds = String(date.getSeconds()).padStart(2, '0')
    const milliseconds = String(date.getMilliseconds()).padStart(3, '0')
    return `${year}-${month}-${day}-${hours}-${minutes}-${seconds}-${milliseconds},UTC`
  }

  // 格式化时间为yyyy-MM-dd-HH-mm-ss-fff格式
  function formatLocalDateTime(date) {
    if (!date) return '---'
    const year = date.getFullYear()
    const month = String(date.getMonth() + 1).padStart(2, '0')
    const day = String(date.getDate()).padStart(2, '0')
    const hours = String(date.getHours()).padStart(2, '0')
    const minutes = String(date.getMinutes()).padStart(2, '0')
    const seconds = String(date.getSeconds()).padStart(2, '0')
    const milliseconds = String(date.getMilliseconds()).padStart(3, '0')
    return `${year}-${month}-${day}-${hours}-${minutes}-${seconds}-${milliseconds}`
  }

  // 格式化线程时间，确保非零值至少显示1ms
  function formatThreadTime(time) {
    const numValue = parseFloat(time)
    const value = parseInt(time)
    return numValue > 0 ? Math.max(1, value) : value
  }

  function formatLargeNumber(number) {
    if (number < 1024) return String(number)
    let value = number / 1024.0
    if (value < 100) return String(value.toFixed(1)) + 'k'
    if (value < 1024) return String(value.toFixed(0)) + 'k'
    value = value / 1024.0
    if (value < 100) return String(value.toFixed(1)) + 'M'
    if (value < 1024) return String(value.toFixed(0)) + 'M'
    value = value / 1024.0
    if (value < 100) return String(value.toFixed(1)) + 'G'
    return String(value.toFixed(0)) + 'G'
  }

  // 更新应用状态
  async function updateAppStatus() {
    if (isUpdatingAppStatus.value) return
    isUpdatingAppStatus.value = true

    try {
      const status = await agencyAsync.getAppStatus()
      const appMode = await agencyAsync.getAppMode()
      const withRec = await agencyAsync.isFileOutputEnabled()
      const languageStore = useLanguageStore()
      appStatus.value = getAppStatusText(appMode, status, withRec, languageStore.isChinese)
    } catch (error) {
      console.error('Failed to update app status:', error)
      appStatus.value = '---'
    } finally {
      isUpdatingAppStatus.value = false
    }
  }

  // 更新网络时间
  async function updateInternetTime() {
    if (isUpdatingInternetTime.value) return
    isUpdatingInternetTime.value = true

    try {
      const ntpTime = await agencyAsync.getInternetNTPTime()
      if (ntpTime) {
        const date = new Date(ntpTime)
        internetTime.value = formatDateTime(date)
      } else {
        internetTime.value = '---'
      }
    } catch (error) {
      console.error('Failed to update internet time:', error)
      internetTime.value = '---'
    } finally {
      isUpdatingInternetTime.value = false
    }
  }

  // 更新主机时间和卫星时间
  async function updateTimeInSession() {
    const currentSession = await agencyAsync.getCurrentOnlineSession()
    if (currentSession) {
      const cpuTimeModel = await agencyAsync.getCPUTimeModel(currentSession)
      if (cpuTimeModel) {
        const cpuTicksPerSecond = cpuTimeModel.cpuTicksPerSecond
        if (cpuTicksPerSecond > 0) {
          const cpuTick = await agencyAsync.getCPUTick()
          const time = Number((cpuTick - cpuTimeModel.startCPUTick)) / Number(cpuTicksPerSecond)
          timeInSession = new AppoxTimeWithSession(currentSession, time)
        } else {
          timeInSession = null
        }
      } else {
        timeInSession = null
      }
    } else {
      const bufferRange = appoxUtility.getBufferRangeLocal()
      if (bufferRange) {
        timeInSession = await agencyAsync.convertTimeIntoSession(bufferRange.end)
      } else {
        timeInSession = null
      }
    }
  }

  // 更新主机时间
  async function updateHostTime() {
    if (isUpdatingHostTime.value) return
    isUpdatingHostTime.value = true

    try {
      if (timeInSession) {
        const localDateTime = await agencyAsync.getLocalDateTime(timeInSession.session, timeInSession.time, false)
        if (localDateTime) {
          const date = new Date(localDateTime)
          hostTime.value = formatLocalDateTime(date)
        } else {
          hostTime.value = '---'
        }
      } else {
        hostTime.value = '---'
      }
    } catch (error) {
      console.error('Failed to update host time:', error)
      hostTime.value = '---'
    } finally {
      isUpdatingHostTime.value = false
    }
  }

  // 更新卫星时间
  async function updateGNSSTime() {
    if (isUpdatingGNSSTime.value) return
    isUpdatingGNSSTime.value = true

    try {
      if (timeInSession) {
        const utcDateTime = await agencyAsync.getUTCDateTime(timeInSession.session, timeInSession.time, true)
        if (utcDateTime) {
          const date = new Date(utcDateTime)
          gnssTime.value = formatDateTime(date)
        } else {
          gnssTime.value = '---'
        }
      } else {
        gnssTime.value = '---'
      }
    } catch (error) {
      console.error('Failed to update GNSS time:', error)
      gnssTime.value = '---'
    } finally {
      isUpdatingGNSSTime.value = false
    }
  }

  // 更新设备状态
  async function updateDeviceStatus() {
    if (isUpdatingDeviceStatus.value) return
    isUpdatingDeviceStatus.value = true

    try {
      const deviceStatuses = await agencyAsync.getAllDeviceStatus()
      if (deviceStatuses) {
        const errorList = []
        const warningList = []
        const okList = []
        for (const [key, value] of Object.entries(deviceStatuses)) {
          if (value.Status === appoxEnums.GeneralDeviceStatus.Error) errorList.push(key)
          if (value.Status === appoxEnums.GeneralDeviceStatus.Warning) warningList.push(key)
          if (value.Status === appoxEnums.GeneralDeviceStatus.OK) okList.push(key)
        }
        const languageStore = useLanguageStore()
        if (errorList.length > 0) {
          deviceStatus.value = `${languageStore.isChinese ? '(错误) ' : '(Error): '}${errorList.join(',')}`
        } else if (warningList.length > 0) {
          deviceStatus.value = `${languageStore.isChinese ? '(警告) ' : '(Warning): '}${warningList.join(',')}`
        } else if (okList.length > 0) {
          deviceStatus.value = `${languageStore.isChinese ? '(正常) ' : '(OK): '}${okList.length}`
        } else {
          deviceStatus.value = '---'
        }
      } else {
        deviceStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update device status:', error)
      deviceStatus.value = '---'
    } finally {
      isUpdatingDeviceStatus.value = false
    }
  }

  // 更新存储状态
  async function updateStorageStatus() {
    if (isUpdatingStorageStatus.value) return
    isUpdatingStorageStatus.value = true

    try {
      const storageCapacity = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.StorageCapacity)
      const storageFree = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.StorageFree)
      const storageHours = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.StorageFreeHours)
      if (storageCapacity && storageFree) {
        const capacity = parseInt(storageCapacity)
        const free = parseInt(storageFree)
        const languageStore = useLanguageStore()
        let status = `${(free / (1024 * 1024 * 1024)).toFixed(1)}GB/${(capacity / (1024 * 1024 * 1024)).toFixed(1)}GB`
        
        if (storageHours) {
          const hours = parseFloat(storageHours)
          status += ` (${hours.toFixed(1)} ${languageStore.isChinese ? '小时' : 'hr'})`
        }
        
        storageStatus.value = status
      } else {
        const languageStore = useLanguageStore()
        storageStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update storage status:', error)
      storageStatus.value = '---'
    } finally {
      isUpdatingStorageStatus.value = false
    }
  }

  // 更新内存状态
  async function updateMemoryStatus() {
    if (isUpdatingMemoryStatus.value) return
    isUpdatingMemoryStatus.value = true

    try {
      const memoryCapacity = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.MemoryCapacity)
      const memoryFree = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.MemoryFree)
      if (memoryCapacity && memoryFree) {
        const capacity = parseInt(memoryCapacity)
        const free = parseInt(memoryFree)
        memoryStatus.value = `${Math.floor(free / (1024 * 1024))}MB/${Math.floor(capacity / (1024 * 1024))}MB`
      } else {
        memoryStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update memory status:', error)
      memoryStatus.value = '---'
    } finally {
      isUpdatingMemoryStatus.value = false
    }
  }

  // 更新CPU状态
  async function updateCPUStatus() {
    if (isUpdatingCPUStatus.value) return
    isUpdatingCPUStatus.value = true

    try {
      const cpuUsage = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.CPUUsage)
      if (cpuUsage) {
        cpuStatus.value = `${parseFloat(cpuUsage).toFixed(1)}%`
      } else {
        cpuStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update CPU status:', error)
      cpuStatus.value = '---'
    } finally {
      isUpdatingCPUStatus.value = false
    }
  }

  // 更新记录队列状态
  async function updateRecordQueueStatus() {
    if (isUpdatingRecordQueueStatus.value) return
    isUpdatingRecordQueueStatus.value = true

    try {
      const continuousBuffer = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.ContinuousFileWriteQueue)
      const eventSessionBuffer = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.EventFileWriteQueue)
      if (continuousBuffer && eventSessionBuffer) {
        recordQueueStatus.value = `${parseFloat(continuousBuffer).toFixed(1)}s/${parseInt(eventSessionBuffer)}s`
      } else {
        recordQueueStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update record queue status:', error)
      recordQueueStatus.value = '---'
    } finally {
      isUpdatingRecordQueueStatus.value = false
    }
  }

  // 更新视频处理队列状态
  async function updateVideoProcessQueueStatus() {
    if (isUpdatingVideoProcessQueueStatus.value) return
    isUpdatingVideoProcessQueueStatus.value = true

    try {
      const videoQueue = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.VideoProcessQueue)
      const videoCapacity = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.VideoProcessQueueCapacity)
      if (videoQueue && videoCapacity) {
        const ratio = Math.round(100.0 * parseInt(videoQueue) / parseInt(videoCapacity))
        videoProcessQueueStatus.value = `${ratio}%`
      } else {
        videoProcessQueueStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update video process queue status:', error)
      videoProcessQueueStatus.value = '---'
    } finally {
      isUpdatingVideoProcessQueueStatus.value = false
    }
  }

  // 更新工作线程状态
  async function updateBaseThreadStatus() {
    if (isUpdatingBaseThreadStatus.value) return
    isUpdatingBaseThreadStatus.value = true

    try {
      const baseThreadTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.WorkthreadLoopTime)
      if (baseThreadTime) {
        baseThreadStatus.value = `${formatThreadTime(baseThreadTime)}ms`
      } else {
        baseThreadStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update base thread status:', error)
      baseThreadStatus.value = '---'
    } finally {
      isUpdatingBaseThreadStatus.value = false
    }
  }

  // 更新UI线程状态
  async function updateMainThreadStatus() {
    if (isUpdatingMainThreadStatus.value) return
    isUpdatingMainThreadStatus.value = true

    try {
      const mainThreadTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.MainthreadLoopTime)
      if (mainThreadTime) {
        mainThreadStatus.value = `${formatThreadTime(mainThreadTime)}ms`
      } else {
        mainThreadStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update main thread status:', error)
      mainThreadStatus.value = '---'
    } finally {
      isUpdatingMainThreadStatus.value = false
    }
  }

  // 更新处理线程状态
  async function updateProcessThreadStatus() {
    if (isUpdatingProcessThreadStatus.value) return
    isUpdatingProcessThreadStatus.value = true

    try {
      const processThreadTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.ProcthreadLoopTime)
      if (processThreadTime) {
        processThreadStatus.value = `${formatThreadTime(processThreadTime)}ms`
      } else {
        processThreadStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update process thread status:', error)
      processThreadStatus.value = '---'
    } finally {
      isUpdatingProcessThreadStatus.value = false
    }
  }

  // 更新文件线程状态
  async function updateFileThreadStatus() {
    if (isUpdatingFileThreadStatus.value) return
    isUpdatingFileThreadStatus.value = true

    try {
      const fileReadTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.FileReadThreadLoopTime)
      const fileWriteTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.FileWriteThreadLoopTime)
      if (fileReadTime && fileWriteTime) {
        fileThreadStatus.value = `${formatThreadTime(fileReadTime)}ms/${formatThreadTime(fileWriteTime)}ms`
      } else {
        fileThreadStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update file thread status:', error)
      fileThreadStatus.value = '---'
    } finally {
      isUpdatingFileThreadStatus.value = false
    }
  }

  // 更新总线流量状态
  async function updateBusFlowStatus() {
    if (isUpdatingBusFlowStatus.value) return
    isUpdatingBusFlowStatus.value = true

    try {
      const busFlow = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.BusDataFlow)
      if (busFlow) {
        busFlowStatus.value = `${formatLargeNumber(parseInt(busFlow))}B`
      } else {
        busFlowStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update bus flow status:', error)
      busFlowStatus.value = '---'
    } finally {
      isUpdatingBusFlowStatus.value = false
    }
  }

  // 更新视频流量状态
  async function updateVideoFlowStatus() {
    if (isUpdatingVideoFlowStatus.value) return
    isUpdatingVideoFlowStatus.value = true

    try {
      const videoFlow = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.VideoDataFlow)
      if (videoFlow) {
        videoFlowStatus.value = `${formatLargeNumber(parseInt(videoFlow))}pix`
      } else {
        videoFlowStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update video flow status:', error)
      videoFlowStatus.value = '---'
    } finally {
      isUpdatingVideoFlowStatus.value = false
    }
  }

  // 更新开始停止状态
  async function updateStartStopStatus() {
    if (isUpdatingStartStopStatus.value) return
    isUpdatingStartStopStatus.value = true

    try {
      const startTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.StartSessionTime)
      const stopTime = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.StopSessionTime)
      if (startTime) {
        startStopStatus.value = `${parseInt(startTime)}ms${stopTime ? `/${parseInt(stopTime)}ms` : ''}`
      } else {
        startStopStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update start stop status:', error)
      startStopStatus.value = '---'
    } finally {
      isUpdatingStartStopStatus.value = false
    }
  }

  // 更新网络状态
  async function updateInternetStatus() {
    if (isUpdatingInternetStatus.value) return
    isUpdatingInternetStatus.value = true

    try {
      const isInternetConnected = await agencyAsync.isInternetConnected()
      const languageStore = useLanguageStore()
      internetStatus.value = isInternetConnected ? languageStore.isChinese ? '已连接' : 'Connected' : '---'
    } catch (error) {
      console.error('Failed to update internet status:', error)
      internetStatus.value = '---'
    } finally {
      isUpdatingInternetStatus.value = false
    }
  }

  // 更新显存状态
  async function updateGPUMemoryStatus() {
    if (isUpdatingGPUMemoryStatus.value) return
    isUpdatingGPUMemoryStatus.value = true

    try {
      const gpuInfos = await agencyAsync.getGraphicCardInfos()
      if (gpuInfos && gpuInfos.length > 0) {
        // 每秒切换一次GPU信息显示
        const target = gpuInfos[Math.floor(Date.now() / 1000) % gpuInfos.length]
        let id = ''
        switch (target.vendor) {
          case appoxEnums.GraphicCardVendor.NVidia:
            id += 'NV'
            break
          case appoxEnums.GraphicCardVendor.AMD:
            id += 'AMD'
            break
          default:
            id += 'UN'
            break
        }
        
        if (id.length > 0) {
          id += (target.cardIndex + 1)
        }
        
        const k = 1024 * 1024
        gpuMemoryStatus.value = `${id}: ${Math.floor(Number(target.memoryFree) / k)}/${Math.floor(Number(target.memoryCapacity) / k)}MB`
      } else {
        gpuMemoryStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update GPU memory status:', error)
      gpuMemoryStatus.value = '---'
    } finally {
      isUpdatingGPUMemoryStatus.value = false
    }
  }

  // 更新回放瓶颈状态
  async function updateReplayNeckStatus() {
    if (isUpdatingReplayNeckStatus.value) return
    isUpdatingReplayNeckStatus.value = true

    try {
      const replayNeck = await agencyAsync.getSystemStatus(appoxEnums.SystemStatus.ReplayNeck)
      if (replayNeck) {
        replayNeckStatus.value = replayNeck
      } else {
        replayNeckStatus.value = '---'
      }
    } catch (error) {
      console.error('Failed to update replay neck status:', error)
      replayNeckStatus.value = '---'
    } finally {
      isUpdatingReplayNeckStatus.value = false
    }
  }

  // 主更新函数
  async function updateSystemStatus() {
    // 并行执行所有更新
    await Promise.all([
      updateAppStatus(),
      updateInternetTime(),
      updateTimeInSession(),
      updateHostTime(),
      updateGNSSTime(),
      updateDeviceStatus(),
      updateStorageStatus(),
      updateMemoryStatus(),
      updateCPUStatus(),
      updateRecordQueueStatus(),
      updateVideoProcessQueueStatus(),
      updateBaseThreadStatus(),
      updateMainThreadStatus(),
      updateProcessThreadStatus(),
      updateFileThreadStatus(),
      updateBusFlowStatus(),
      updateVideoFlowStatus(),
      updateStartStopStatus(),
      updateInternetStatus(),
      updateGPUMemoryStatus(),
      updateReplayNeckStatus()
    ])
  }

  return {
    // 状态
    appStatus,
    internetTime,
    hostTime,
    gnssTime,
    deviceStatus,
    storageStatus,
    memoryStatus,
    gpuMemoryStatus,
    cpuStatus,
    recordQueueStatus,
    videoProcessQueueStatus,
    replayNeckStatus,
    baseThreadStatus,
    mainThreadStatus,
    processThreadStatus,
    fileThreadStatus,
    busFlowStatus,
    videoFlowStatus,
    startStopStatus,
    internetStatus,
    // 更新状态标志
    isUpdatingAppStatus,
    isUpdatingInternetTime,
    isUpdatingHostTime,
    isUpdatingGNSSTime,
    isUpdatingDeviceStatus,
    isUpdatingStorageStatus,
    isUpdatingMemoryStatus,
    isUpdatingCPUStatus,
    isUpdatingRecordQueueStatus,
    isUpdatingVideoProcessQueueStatus,
    isUpdatingBaseThreadStatus,
    isUpdatingMainThreadStatus,
    isUpdatingProcessThreadStatus,
    isUpdatingFileThreadStatus,
    isUpdatingBusFlowStatus,
    isUpdatingVideoFlowStatus,
    isUpdatingStartStopStatus,
    isUpdatingInternetStatus,
    isUpdatingGPUMemoryStatus,
    isUpdatingReplayNeckStatus,
    // 动作
    updateSystemStatus
  }
}) 